package top.jiangqiang.qianyi.business.model.request;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import top.jiangqiang.qianyi.common.constants.auth.Platform;
import top.jiangqiang.qianyi.common.constants.log.SysLogType;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 系统日志
 * </p>
 *
 * @author JiangQiang
 * @since 2024-06-03
 */
@Data
@Schema(name = "SysLogListRequest", description = "系统日志")
public class SysLogListRequest implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "主键")
    private Long id;

    @Schema(description = "请求时间")
    private LocalDateTime requestTime;

    @Schema(description = "请求路径")
    private String requestUrl;

    @Schema(description = "日志名称")
    private String logName;

    @Schema(description = "请求方式，GET/POST")
    private String requestMethod;

    @Schema(description = "mime-type")
    private String contentType;

    @Schema(description = "请求体")
    private String requestBody;

    @Schema(description = "请求参数")
    @TableField(typeHandler = JacksonTypeHandler.class)
    private Map<String, List<String>> requestParam;

    @Schema(description = "请求头参数")
    @TableField(typeHandler = JacksonTypeHandler.class)
    private Map<String, List<String>> requestHeader;

    @Schema(description = "登录的应用类型，前台或后台")
    private Platform loginType;

    @Schema(description = "访问令牌")
    private String token;

    @Schema(description = "controller类名称")
    private String className;

    @Schema(description = "controller方法名称")
    private String methodName;

    @Schema(description = "用户信息id")
    private Long userInfoId;

    @Schema(description = "请求ip")
    private String requestIp;

    @Schema(description = "日志类型，枚举存储")
    private SysLogType logType;

    @Schema(description = "处理时长")
    private Integer processingTime;

    @Schema(description = "响应时间")
    private LocalDateTime responseTime;

    @Schema(description = "http状态码")
    private Integer httpCode;

    @Schema(description = "业务状态码")
    private Integer responseCode;

    @Schema(description = "响应结果消息")
    private String responseMessage;

    @Schema(description = "响应数据")
    private String responseData;

    @Schema(description = "异常类名称")
    private String exceptionName;

    @Schema(description = "异常信息")
    private String exceptionMessage;

    @Schema(description = "请求来源地址")
    private String referer;

    @Schema(description = "用户环境")
    private String userAgent;

}
